#!/usr/bin/env python
#coding=utf-8
"""
socket server
"""
import smtplib

def sendmail(subject='', msg='', fromaddr='369413651@qq.com', toaddrs=['369413651@qq.com']):
	from email.mime.text import MIMEText
	from email.mime.multipart import MIMEMultipart

	mail_msg = MIMEMultipart()
	mail_msg['Subject'] = subject
	mail_msg['From'] = fromaddr
	mail_msg['To'] = ','.join(toaddrs)
	mail_msg.attach(MIMEText(msg, 'html', 'utf-8'))

	# print mail_msg.as_string()
	s = smtplib.SMTP('localhost')
	s.sendmail(fromaddr, toaddrs, mail_msg.as_string())
	s.quit()

if __name__ == '__main__':
	sub = 'mail test'
	msg = '<html><body>You Know. </body></html>'
	sendmail(sub, msg)